home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 25
/
Cream of the Crop 25.iso
/
doom
/
axxwar_1.zip
/
SOURCES
/
FLARES.QC
< prev
next >
Wrap
Text File
|
1997-03-05
|
4KB
|
163 lines
void() spike_touch;
void() superspike_touch;
void(vector org, vector vel, float damage) SpawnBlood;
void(float damage) spawn_touchblood;
// AXXFL START
void() flare_touch;
void() flare_bright;
void() flare_dim;
/*
================================
launch_flare
rework of id's launch_spike code
================================
*/
void(vector org, vector dir) launch_flare =
{
local entity missile;
missile = spawn ();
missile.owner = self;
missile.movetype = MOVETYPE_FLYMISSILE;
missile.solid = SOLID_BBOX;
missile.angles = vectoangles(dir);
// go to flare_touch if the flare touches anything
missile.touch = flare_touch;
missile.classname = "flare";
// go to flare_bright when the flare's think time is up
missile.think = flare_bright;
// 3 seconds until flare goes bright
missile.nextthink = time + 3;
// The LASER.MDL makes a decent flare
setmodel (missile, "progs/laser.mdl");
setsize (missile, VEC_ORIGIN, VEC_ORIGIN);
setorigin (missile, org);
missile.velocity = dir * 1000;
// Make the flare dim. (.effects is an 8-bit register)
missile.effects=EF_DIMLIGHT;
};
/*
============================
flare_touch
rework of id's spike_touch()
============================
*/
void() flare_touch =
{
local float rand;
if (other == self.owner)
return;
if (other.classname == "door" || other.classname == "plat")
{
remove(self);
return;
}
if (other.solid == SOLID_TRIGGER)
return; // trigger field, do nothing
if (pointcontents(self.origin) == CONTENT_SKY)
{
remove(self);
return;
}
// has the flare hit something that bleeds?
if (other.takedamage)
{
// If so, spawn some blood
spawn_touchblood (9);
// also do one point of damage
T_Damage (other, self, self.owner, 1);
/*
Don't remove the flare unless it is still flying. Otherwise, monsters or
other players can come up and 'pull' your flare out of the wall
*/
if (self.velocity != '0 0 0')
remove(self);
}
else
{
// Write information to the network
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_SPIKE);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
}
//Stop the flare, but do not remove it.
self.movetype = MOVETYPE_NONE;
// Fix it so that flare only partially embeds itself (thanks, Luke)
self.origin = self.origin - self.velocity * 0.005;
self.velocity = '0 0 0';
self.touch = SUB_Null;
};
/*
==============================
flare_bright()
This function makes the flare
emit brighter light
==============================
*/
void() flare_bright =
{
local vector vel;
// Make the flare get BRIGHT by setting .effects bit
self.effects=EF_BRIGHTLIGHT;
// Give it 10 seconds at maximum intensity
self.nextthink = time + 10;
// After 10 seconds, call flare_dim
self.think = flare_dim;
// Play a sound for flare ignition
sound (self, CHAN_WEAPON, "misc/power.wav", 1, ATTN_NORM);
// Set up some red and yellow sparks
vel = '0 0 150';
particle (self.origin+vel*0.01,vel,111,150);
vel = '0 0 120';
particle (self.origin+vel*0.01,vel,73,200);
/*
==============================
flare_dim()
This function makes the flare
go dim again
==============================
*/
};
void() flare_dim =
{
// Make the flare get dim by setting .effects bit
self.effects=EF_DIMLIGHT;
// Give it 15 seconds before burnout
self.nextthink = time + 15;
// After 15 seconds remove the flare from the game
self.think = SUB_Remove;
};
// AXXFL END